Method and System for Processing a Text Search Query in a Collection of Documents

ABSTRACT

According to the present invention a method and an infrastructure are provided for processing a text search query in a collection of documents ( 100 ). Therefore, a full posting index ( 200 ) is generated, stored and updated for each document added to the collection ( 100 ). Said full posting index ( 200 ) comprising a set of index terms and a full posting list for each index term of said set, enumerating all occurrences of said index term in all documents of the collection ( 100 ). In addition to said full posting index ( 200 ) at least one additional posting index ( 400, 500, 600 ) is generated, stored and updated for each document added to the collection ( 100 ). Said additional posting index ( 400, 500, 600 ) is related to a defined document part and comprises a set of index terms and a restricted posting list for each index term of said set, enumerating all occurrences of said index term in said document part of all documents of the collection ( 100 ).  
     A text search query comprises search conditions on search terms, which are translated into conditions on the index terms of said full posting index ( 200 ). Then, said translated conditions of a given text search query are optimized (a) by identifying all conditions of said translated conditions, which are restricted to defined document parts, for which an additional posting index is available, and 
         (b) by re-writing said identified conditions with part restriction as pair conditions on index terms of said additional posting index ( 400, 500, 600 ) and the corresponding document part. 
 
Thus, said pair conditions can be processed by using only said additional posting index ( 400, 500, 600 ).

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a method and an infrastructure for processing text search queries in a collection of documents. Particularly, the present invention relates to a method and an infrastructure for processing text search queries being restricted to a defined document part, as e.g. to a field like the title or abstract of a document.

2. Description of the Related Art

The purpose of a text search query is usually to find those documents in a collection of documents that fulfil certain criteria, the so called search conditions, such as that the document should contain certain words. In many cases, the “relevance” of documents fulfilling the given search conditions has to be calculated as well. Most often, users are only interested in seeing the “best” documents as result of a text search query. As the size of document collections to be searched is constantly increasing, efficiency of text search query processing becomes an ever more important issue.

Text search query processing for fulltext search is usually based on “inverted indexes”. To generate inverted indexes for a collection of documents, all documents are analysed to identify the occurring words or search terms as index terms together with their positions in the documents. In an “inversion step” this information is basically sorted so that the index term becomes the first order criteria. The result is stored in a full posting index comprising basically two parts. The first part, also called the dictionary, is a data structure for fast lookup of all index terms that have been encountered during indexing whereas the second part stores all occurrence information as a pool of full posting lists. Each dictionary entry, i.e. each index term, holds a reference to a full posting list enumerating all occurrences of said index term in all documents of the collection. Usually, the posting lists are coded and compressed for storing.

FIG. 1 illustrates an example for a collection of documents 100 and a corresponding full posting index 200. The collection of documents 100 comprises three text documents doc1, doc2 and doc3. Each of this documents is a sequences of index terms a, b, c and d. E.g. doc1 can be expressed as the following XML-fragment <document>   <title>     a<bold>b</bold>   <title>   <body>     c<bold>b</bold>d   <body> <document> The index terms a, b, c and d form the dictionary, i.e. the set of index terms, the full posting index 200 is based on. It comprises a full posting list for each index term a, b, c and d, enumerating all occurrences of the corresponding index term in all documents doc1, doc2 and doc3 of the collection. In the here described example the occurrences of an index term are grouped by document.

The full posting index 200 can be used to process e.g. the query “find all documents containing the phrase ‘a b’ ”. Therefore, the search engine looks up all positions for “a” and all positions for “b”. Then, the conditions whether “a” and “b” occur in the same document and whether “b” occurs in the position immediately after “a” are checked.

An important feature of text search engines is to be able to restrict searches to certain document parts, as e.g. fields, like title, abstract, body, etc., which are known at indexing time. A field of a document is conceptually viewed as subset of the positions of the words in a document. Thus, it is possible to define continuous as well as discontinuous fields, e.g. the “field” of all highlighted words or the “field” of all figure captions, and also overlapping fields, e.g. all highlighted words in title field. The fraction of all positions, that are inside a given field, in all documents of a given collection is called the coverage of said field in said collection of documents.

In order to process queries comprising field restrictions, information about the extent of each field has to be added to the index. It is state of the art to use special posting lists for fields stored in a field posting index. Such a field posting index comprises a set of fields and a field posting list for each field of said set, enumerating the start and end positions of the continues parts of said field in all documents of the collection.

In the example illustrated by FIG. 1 each document of the collection 100 starts with a “title” field, marked by underline, whereas the remainder is defined as “body” field. A third field is defined as “highlighted” and contains all highlighted, i.e. bold face, words of the corresponding document.

Consequently, the corresponding field posting index 300 comprises the dictionary entries “title”, “body” and “highlighted” and the corresponding field posting lists, enumerating the start and end positions of the continues parts of each field in all documents of the collection. In the here described example the occurrences of a field are grouped by document.

This field posting index 300 can be used to process queries comprising a field restriction, like e.g. “find all documents containing the phrase ‘a b’ in the title field”. Usually, this is done by first searching for candidates fulfilling the unrestricted query. In the here described example, one match in doc1 from position 1 to position 2 is found. Only then, the search engine checks the positions of the match against the positions stored in the field posting index 300, namely in the field posting list of the field “title”. In the here described example, the match is contained in the title extent of doc1, hence yielding one hit for the complete query.

The example described above illustrates the general way to process a query comprising field restrictions. In a first step the corresponding non-restricted query is processed by using the full posting index. Then, some form of additional filtering is applied on the result set of the non-restricted query by using the field posting index. This additional checking of field restrictions leads to an overall query runtime exceeding the query runtime of the corresponding non-restricted query. With other words, searching on whole documents is often faster than searching on defined document parts. This is contrary to the user's expectation that a query on small parts of the documents should perform better than a query on whole documents.

OBJECT OF THE INVENTION

Starting from this, the object of the present invention is to improve the efficiency of processing text search queries being restricted to defined document parts.

BRIEF SUMMARY OF THE INVENTION

The foregoing object is achieved by a method and an infrastructure as laid out in the independent claims. Further advantageous embodiments of the present invention are described in the subclaims and are taught in the following description.

According to the present invention a method is provided for processing text search queries in a collection of documents. A full posting index is generated, stored and updated for each document added to the collection. Said full posting index comprises a set of index terms and a full posting list for each index term of said set, enumerating all occurrences of said index term in all documents of the collection. In addition to said full posting index at least one additional posting index is generated, stored and updated for each document added to the collection. Said additional posting index is related to a defined document part and comprises a set of index terms and a restricted posting list for each index term of said set, enumerating all occurrences of said index term in said document part of all documents of the collection. A text search query comprises search conditions on search terms, which are translated into conditions on the index terms of said full posting index. The resultant translated conditions of a given text search query are optimized

-   -   (a) by identifying all conditions of said translated conditions,         which are restricted to defined document parts, for which an         additional posting index is available, and     -   (b) by re-writing said identified conditions with part         restriction as pair conditions on index terms of said additional         posting index and the corresponding document part.

Then, said pair conditions can be processed by using only said additional posting index.

Thus, the present invention provides a possibility to process restricted search conditions by using only a corresponding additional posting index without accessing the full posting index and without accessing the field posting index. This allows significant improvements of query efficiency for this kind of queries.

As one aspect dominating query runtime is reading the corresponding index posting lists from disk, it is highly advantageous to use an additional posting index, as proposed by the invention, which usually is much smaller than the full posting index. Thus, reading said additional posting index from disk is significantly faster than reading the full posting index because less data has to be moved in I/O operations. Another aspect dominating query runtime is finding the next possible match in a posting list. E.g., if “a” was found in document 2576, then the search engine should skip in the posting list of “b” to this document. Then a match is indicated, if document 2576 is mentioned in the posting list of “b”. Else, if that position does not exist, no match was found. Necessary for processing this next( ) operation is the decompression and decoding of the posting lists. Also, the processing of next( ) operations, as described above, is significantly easier when using an additional posting index according to the invention, because it is smaller than the full posting index.

For many applications, the additional posting indexes being related to a defined document parts will be based on the same set of index terms as the full posting index. However, it should be noted here, that the additional posting index may also be based on a set of index terms, which is not identical with the set of index terms the full posting index is based on. In some cases it might be advantageous to restrict the additional posting index to a smaller set of most significant index terms, whereas there might be other search conditions, which can be processed more efficiently by using an additional posting index with an extended set of index terms.

There exists a trade-off between the overall index size, i.e. the size of the full posting index and all additional posting indexes, and the corresponding indexing runtime on the one hand and query runtime on the other hand. The actual gains or losses on either side can be very different depending on the characteristics of the document part being related to an additional posting index and especially on the coverage of said document part. Using an additional posting index for a low-coverage document part is highly advantageous, because on average this will result in huge query performance improvements for query conditions being restricted to said document part at the cost of only minimally increasing index size and indexing runtimes. For instance, using an additional posting index for the field “title” in a large document collection leads to a speed-up by an order of magnitude for queries searching mainly in the title of the documents. On the contrary, it is less useful to generate an additional posting index for the field “body”, because this is usually a field with high coverage. Besides, the search conditions of text search queries are rarely restricted to the “body” field only excluding other fields, like the title, the abstract, etc.

According to the invention, an additional posting index can be generated for all kinds of document parts, which means for all kinds of subqueries defining document parts. An additional posting index is especially useful for processing field conditions, but can also be generated for processing phrases and proximity conditions. Keeping in mind, that there exists a trade-off between the overall index size and the query runtime, additional posting indexes should be generated especially for sub-queries defining document parts with low coverage.

Another aspect to be considered when deciding upon generating an additional posting index for a specific document part, i.e. optimizing on said document part, is, how often it is used in queries. It is advantageous to generate additional posting indexes especially for sub-queries which are frequently used.

In this context, it should be mentioned, that one major advantage of the approach proposed by the invention is the configurability of optimization, i.e. the possibility to choose document parts which are important in connection with a given querying profile and to generate additional posting indexes especially for these document parts. Thus, the method according to the invention is adaptable to different querying profiles.

Another advantage is, that the restricted posting lists of additional posting indexes are designed to enter the computation of more complex queries comprising a subquery of the given form, because they are stored in the same canonical order as the posting lists of the full posting index. I.e. the posting lists of an additional posting index use the same sequence of document Ids as the posting lists of the full posting index. This canonical order is mandatory to enable fast intersection and union algorithm that are needed to realise AND and OR operations.

Another advantage of the invention touches the estimation components for optimization purposes. Since all queries of the form “index term in document part” are pre-computed, if there exists an additional posting index for said document part, there are exact numbers of their result sizes, as well as very good estimates of their processing CPU and I/O costs. When queries of this form are encountered as subqueries in a larger query, the query optimizer which is guided by those estimates will be able to produce better access plans than in the non-optimized case, where these estimates are likely to contain errors.

An additional posting index can be generated for a defined document part by using the full posting index, which holds all information about the restricted posting lists to be computed for the index terms of said additional posting index.

In another advantageous embodiment of the present invention, wherein the additional posting index is related to a field, said additional posting index is generated and updated together with generating and updating of the full posting index and a field posting index comprising a set of fields and a field posting list for each field of said set, enumerating the start and end positions of the continues parts of said field in all documents of the collection. With other words, in this case an additional posting index can be generated during indexing, when all documents of the collection are scanned to obtain occurrence information for each index term and field information. The occurrence information will be added not only to the full posting index but also to all additional posting indexes being concerned by using the field information, which is added to the field posting index.

In an advantageous embodiment of the present invention additional posting indexes are used for ranking the resultant documents of a given text search query.

Commonly used ranking or scoring algorithms for text search take into account the frequency of an index term in a document or the weighted frequency, which means the frequency of said index term weighted dependent on the document part of its occurrence.

Another important aspect for ranking is the overall number of occurrences of the index term in the collection, wherein very general terms are less significant. This information has to be available for score computation.

Consider the ranking of result documents in an index that is built only over a certain field of a document collection, say the title field. As described above, the ranking commonly depends on the term frequency and document frequency values of the term and the document to be ranked in the given index. These values may be significantly different when only the title part of a document is considered.

Therefore, the present invention proposes to enhance the restricted posting lists of an additional posting index by adding ranking information about the weighted and/or unweighted index term frequency in each document, e.g. a term salience value which represents a generalisation of term frequency that takes other factors into account which provide evidence for the salience of the index term in a given document as a whole. This ranking information is extracted from the full posting index at indexing time.

A further object of the present invention is to provide an infrastructure for processing a text search query according to the method described above. This infrastructure comprises means for generating and storing a full posting index and updating said full posting index for each document added to the collection. Said full posting index comprises a set of index terms and a full posting list for each index term of said set, enumerating all occurrences of said index term in all documents of the collection. Besides, there are means for generating and storing an additional posting index and updating said additional posting index for each document added to the collection. Said additional posting index is related to a defined document part and comprises a set of index terms and a restricted posting list for each index term of said set, enumerating all occurrences of said index term in said document part of all documents of the collection. Said infrastructure further comprises means for translating the search conditions on search terms of a given text search query into conditions on the index terms of said full posting index and means for optimizing the translated conditions of a given text search query

-   -   (a) by identifying all conditions of said translated conditions,         which are restricted to defined document parts, for which an         additional posting index is available, and     -   (b) by re-writing said identified conditions with part         restriction as pair conditions on index terms of said additional         posting index and the corresponding document part.

An executor uses said additional posting index to process said pair conditions.

In an advantageous embodiment of the present invention the infrastructure further comprises means for generating and storing a field posting index and updating said field posting index for each document added to the collection, said field posting index comprising a set of fields and a field posting list for each field of said set, enumerating the start and end positions of the continues parts of said field in all documents of the collection.

In a further embodiment of the present invention the infrastructure also comprises estimation components for optimization purposes allowing to estimate query result size, query processing CPU time and query processing I/O time based on statistical information extracted from the full posting index and the additional posting index.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

The novel features of the present invention are set forth in the appended claims. These features, additional objectives and advantages of the present invention as well as preferred modes of use will be apparent and best understood by reference to the following detailed description of illustrative embodiments, when read in conjunction with the accompanying drawing, wherein:

FIG. 1 shows an example for a collection of documents 100 together with a full posting index 200 for this collection of documents 100 and a field posting index 300;

FIG. 2 shows three additional posting indexes 400, 500 and 600 generated according to the invention for the example of FIG. 1;

FIG. 3 shows components of an infrastructure for processing a text search query according to the present invention; and

FIG. 4 shows a flow chart for processing a text search query according to the present invention.

DETAILED DESCRIPTION OF THE INVENTION

FIG. 1 shows an example for a collection of documents 100 together with a full posting index 200 for this collection of documents 100 and a field posting index 300.

As already described in connection with the state of the art, the collection of documents 100 comprises three text documents doc1, doc2 and doc3, containing the search terms a, b, c and d. The full posting index 200 is based on these search terms a, b, c and d and comprises a full posting list for each of these search terms a, b, c and d, enumerating all occurrences of the corresponding search term in all documents doc1, doc2 and doc3 of the collection 100. Besides, in each document doc1, doc2 and doc3 there are a “title” field, a “body” field and a discontinuous field “highlighted”, comprising all highlighted terms of the document. Consequently, the field posting index 300 is based on the set of fields “title”, “body” and “highlighted” and comprises a field posting list for each of said fields, enumerating the start and end positions of the continues parts of said field in all documents of the collection 100.

According to the invention additional posting indexes 400, 500 and 600 are generated, as shown in FIG. 2. Similar to the full posting index 200, said additional posting indexes 400, 500 and 600 are inverted indexes and, thus, based on a set of index terms. In the here described example, the full posting index 200 and the additional posting indexes 400, 500 and 600 use the same set of index terms a, b, c and d. However, it should be mentioned here, that this is only one possibility to realise the present invention. Depending on the querying profile, the additional posting indexes might be based on a smaller more significant set of index terms or even on a larger set of index terms than the full posting index. Each of the additional posting indexes 400, 500 and 600 is related to one of the fields “title”, “body” or “highlighted”, what is indicated by a corresponding pair ‘index term field’. Each of these pairs represents a reference to a restricted posting list, enumerating all occurrences of the corresponding index term in the corresponding field of all documents of the collection 100.

According to the invention these additional posting indexes 400, 500 and 600 are used to process search conditions of a given text search query, which are restricted to the corresponding field. The additional posting indexes 400, 500 and 600 allow to answer those search conditions without accessing the full posting index 200 or the field posting index 300.

Since the search engine has to be able to process all kinds of queries, a full posting index is obligatory. The overhead introduced by adding redundant additional posting indexes has to be set in relation to the gain in query processing when using said additional posting indexes. A significant improvement in query processing can be observed by using additional posting indexes for sub-queries being restricted to document parts with low coverage and for sub-queries which are frequently used.

As mentioned above, FIG. 3 shows the components of an infrastructure necessary for processing a text search query according to the present invention. This diagram is related to FIG. 4, which shows a flow chart for processing the text search query “(a AND b) IN <title>” to exemplify some aspects of the present invention.

In a first step 1 the text search query “(a AND b) IN <title>”, coming from a user, is translated by a query translator 2 into search engine internal, so-called translated conditions 3. Therefore, the search terms, used by the user, are mapped to index terms of the full posting index, e.g. by reducing words to their stems and by ignoring case information. Besides, explicit operators are introduced by translating the original search conditions. In the here described example, this results in the translated conditions 3 “(A AND B) IN title” which are transmitted to a query optimizer 4.

First, the query optimizer 4 checks the index configuration 5 in step 6. The index configuration 5 contains the information for which of all fields stored in the field posting index an additional posting index has been generated. These fields are called optimized fields in the context of the present invention.

Only if “title” is an optimized field, i.e. an additional posting index is available for the “title” field, the query optimizer 4 can re-write the translated conditions 3 as so-called pair condition 7 on the index terms A and B and the “title” field. The resultant re-written conditions 7 are “A title AND B®title”.

In this case, a query executor 8 processes the re-written condition 7 by using only the corresponding optimized field postings, i.e. the corresponding additional posting index, which is stored together with the regular postings, i.e. the full posting index, and the field postings, i.e. the field posting index, in text index 11. The query result 10 is transmitted to a result processor.

If no additional posting index is available for the “title” field it is not possible to re-write the translated conditions 3 according to the invention. Then, the translated conditions 3 have to be processed by using the regular postings, i.e. the full posting index, and the field postings, i.e. the field posting index.

In both cases, the access of the query executor 8 to text index 11 is indicated by arrow 9.

The foregoing example illustrates, that the invention applies especially to text search queries where a fast search on defined document parts becomes an issue. Therefore, the present invention proposes to maintain multiple posting structures, one for the whole documents and one for each document part, that should support fast search. Consequently, the query executor is able to rout queries to the respective index depending on which parts are to be searched.

Once again, it should be pointed out, that the method provided by the invention, allows significant improvements of query efficiency in full text search engines, when queries involve fields, by adding additional material to the overall index and exploiting this information during query processing. The here described approach allows to trade query performance against index size increase by allowing to choose which fields to optimize. Thus, in many cases huge benefits in query performance can be achieved for queries being restricted to fields with only minimum index size increase by selecting the most beneficial fields. 

1-7. (canceled)
 8. A computer system for processing a text search query in a collection of documents, comprising: a computer; a full posting index for the documents of the collection, said full posting index comprising a first set of index terms and a full posting list for said index terms of said first set, enumerating all occurrences of said index terms of said first set in all documents of the collection; search conditions on search terms of a given text search query that are translated into conditions on said index terms to provide translated conditions; an additional posting index for said documents of the collection, said additional posting index being related to a defined document part and comprising a second set of index terms and a restricted posting list for said index terms of said second set, enumerating all occurrences of said index terms of said second set in said document part of said documents of said collection; identified conditions of said translated conditions, which are restricted to defined document parts, for which an additional posting index is available; said identified conditions with part restriction rewritten as pair conditions on index terms of said additional posting index and corresponding document part; and a query result based on said additional posting index and said pair conditions.
 9. The system according to claim 8, further comprising: a field posting index for said documents of the collection, said field posting index comprising a set of fields and a field posting list for each field of said set of fields, enumerating start and end positions of continuous parts of said field in said documents of said collection.
 10. The system according to claim 8 wherein said additional posting index is generated for subqueries defining document parts comprising at least one and any combination of a field condition, phrase and proximity condition.
 11. The system according to claim 8 wherein said additional posting index is generated for sub-queries defining document parts with low coverage.
 12. The system according to claim 8 wherein said additional posting index is generated for sub-queries which are frequently used.
 13. The system according to claim 8 wherein said additional posting index is generated based on said full posting index.
 14. A computer program product stored on a computer readable storage medium, comprising computer readable program means for causing a computer to perform a method of processing a text search query in a collection of documents, wherein the documents of the collection are associated with a full posting index, said full posting index comprising a one or more first index terms and a full posting list, enumerating occurrences of said one or more first index terms in said documents of said collection; and wherein said text search query comprises one or more search conditions on one or more search terms, said one or more search conditions being translated into one or more conditions on said one or more first index terms to provide one or more translated conditions; said method comprising: generating at least one additional posting index, said additional posting index being related to a defined document part and comprising one or more second index terms and a restricted posting list for said one or more second index terms, enumerating occurrences of said one or more second index terms in said document part of said documents of said collection; identifying one or more conditions of said one or more translated conditions for which an additional posting index is available to provide one or more identified conditions; re-writing said one or more identified conditions as one or more pair conditions on said one or more second index terms of said additional posting index and corresponding document part; and processing said one or more pair conditions using said additional posting index to provide a query result.
 15. The computer program product according to claim 14 wherein said additional posting index is generated for subqueries defining document parts comprising at least one or any combination of a field condition, phrase and proximity condition.
 16. The computer program product according to claim 14 wherein said additional posting index is generated for sub-queries defining document parts with low coverage.
 17. The computer program product according to claim 14 wherein said additional posting index is generated for sub-queries which are frequently used.
 18. The computer program product according to claim 14 wherein said additional posting index is generated using said full posting index to compute one or more restricted posting lists for said one or more second index terms.
 19. The computer program product according to claim 14, wherein a field posting index is generated for each document added to said collection, said field posting index comprising a set of fields and a field posting list for each field of said set of fields, enumerating start and end positions of continuous parts of said field in said documents of said collection, wherein said additional posting indexes are generated together with said full posting index and said field posting index.
 20. The computer program product according to claim 14 wherein said additional posting index comprises ranking information about a weighted index term frequency in each document as a whole and wherein said ranking information is extracted from said full posting index. 